package com.demo26_删除数组中的重复项;

public class Solution {
    public int removeDuplicates(int[] nums) {
        int maxIndex= nums.length-1;
        for (int i = 1; i <= maxIndex; i++) {
            if (nums[i]==nums[i-1]){
                for (int j = i; j <=maxIndex; j++) {
                    nums[j-1]=nums[j];
                }
                maxIndex--;
                i--;
            }
        }
        return maxIndex+1;
    }
}
